package io.demo02;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

/**
 * @author cyt
 * @create 2020-02-25 14:31
 */
public class WriterDemo {

    public static void main(String[] args) throws IOException {
        // 创建一个字符流
        Writer writer = null;
        try {
            writer = new FileWriter("f://io_writer.txt");
            String s = "cyt";
            // 指定长度
            writer.write(s, 0, 2);

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                writer.close();
            }
        }
    }
}
